<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8" import="user.*"%>
<%@ page import="java.sql.*"%>

<HEAD>
	<TITLE>Registration</TITLE>
	<META http-equiv=Content-Type content="text/html; charset=gb2312">

</HEAD>

<BODY leftMargin=0 topMargin=10>

	<TABLE cellSpacing=0 cellPadding=0 width=700 align=center border=0>
		<TBODY>
			<TR>
				<TD>
					<DIV align=center>
						<A href="index.jsp"><IMG height=118
								src="Pics/restaurantLogo.JPG" width=242 border=0>
						</A>
					</DIV>
				</TD>
			</TR>
		</TBODY>
	</TABLE>

	<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
		<TR>
			<TD vAlign=top height=60>
				<FORM name="delivery_status" action="administrator_account.jsp"
					method=post>

					<TABLE cellSpacing=1 cellPadding=3 width="60%" align=center
						bgColor=#cccccc border=0>
						<TBODY>

							<tr bgColor=#bbbbbb>
								<td align="center" colspan=3>Update Delivery State</td>
							</tr>
							<tr>
								<td>Types of Order Form</td>
								<td>Customer ID</td>
								<td>Customer Name</td>
							<TR>
								<td>
									<select name="select_status" style="width: 140px">
										<option value="any">any</option>
										<option value="not cooked yet">not cooked yet</option>
										<option value="cooking">cooking</option>
										<option value="ready to deliver">ready to deliver</option>
										<option value="delivering">delivering</option>
										<option value="done">done</option>
									</select>
								</td>
								<td><input name="cus_ID_search" type="text" class="input" size="20"></td>
								<td><input name="cus_name_search" type="text" class="input"	size="20"></td>
							</TR>
							<TR><TD><INPUT type=submit value=search name=SubmitSearchOrderForm></TD></TR>
						</TBODY>
					</TABLE>
				</FORM>

			</TD>
		</TR>

		<tr>
			<td colspan=3>
				<!--  <form action="administrator_account.jsp" method=post>-->
				<form action="./servlet/OrderForm" method=post>
					<TABLE cellSpacing=1 cellPadding=3 width="60%" align=center
						bgColor=#eeeeee>
						<%
							String OrderFormSearchButtonPressed = request.getParameter("SubmitSearchOrderForm");
							if (OrderFormSearchButtonPressed != null
									&& OrderFormSearchButtonPressed.length() > 0) {
								
								String OrderStatus = request.getParameter("select_status");
								String CusID = request.getParameter("cus_ID_search");
								String CusName = request.getParameter("cus_name_search");
						%>
						<%=DisplayOrderForm.displayOrderFormList(OrderStatus, CusID, CusName) %>
						<%} %>
					</table>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="administrator_account.jsp">
					<TABLE cellSpacing=1 cellPadding=3 width="60%" align=center
						bgColor=#cccccc>
						<tr bgColor=#bbbbbb>
							<td align=center colspan=6>The Food Sale</td>
						</tr>
						<tr><td>Keyword :<input name="food_search" type="text" class="input" size="20"></td>
							<td>Order By</td>
							<td><input name='Order_By_Restaurant' type='radio' class='input' value='Order_By_Restaurant'>Restaurant Name</td>
							<td><input name='Order_By_Price' type='radio' class='input' value='Order_By_Price'>Price</td>
							<td><input name='Order_By_Sales' type='radio' class='input' value='Order_By_Sales'>Sales</td>
							<td><input name='Order_By_FoodName' type='radio' class='input' value='Order_By_FoodName'>Food Name</td>
						</tr>
						<tr><td><INPUT type=submit value=search name=SubmitFoodSearch></td>
						</tr>
					</TABLE>
				</form>
				<TABLE cellSpacing=1 cellPadding=3 width="60%" align=center
					bgColor=#eeeeee>
					<%
						//DBConnector db = DBConnector.getDBConnector();	
						String SubmitFoodSearch = request.getParameter("SubmitFoodSearch");
						if (SubmitFoodSearch != null && SubmitFoodSearch.length() > 0) {
							String food_search = request.getParameter("food_search");
							String Order_By_FoodName = request.getParameter("Order_By_FoodName");
							String Order_By_Restaurant = request.getParameter("Order_By_Restaurant");
							String Order_By_Price = request.getParameter("Order_By_Price");
							String Order_By_Sales = request.getParameter("Order_By_Sales");
						%>						
						<%=DisplayFoodPage.DisplayFoodList(food_search, Order_By_FoodName, Order_By_Restaurant, Order_By_Price, Order_By_Sales) %>
						<%}%>
				</TABLE>
			</td>
		</tr>
		<tr><td><br>
		
		<form action="administrator_account.jsp">
					<TABLE cellSpacing=1 cellPadding=3 width="60%" align=center
						bgColor=#cccccc>
						<tr bgColor=#bbbbbb><td align=center colspan=6>The Messages</td></tr>
						<tr><td>Keyword :<input name="message_search" type="text" class="input" size="20"></td>
							<td>Order By</td>							
							<td><input name='Order_By_Topic' type='radio' class='input' value='Order_By_SenderName'>Sender Name</td>
							<td><input name='Order_By_SenderName' type='radio' class='input' value='Order_By_Topic'>Topic</td>
							<td><input name='Order_By_Email' type='radio' class='input' value='Order_By_Email'>Email</td>
						</tr>
						<tr><td><INPUT type=submit value=search name=SubmitMessageSearch></td></tr>						
					</TABLE>
				</form>	
				<TABLE width=60% align = center border=0 cellspacing = 3><tr><td  bgcolor="#cccccc">
				<TABLE width="100%" align="center" border=0 cellspacing="3" cellpadding="3" > 			
		<%
		//search for the messages to display
		try{		
			
			String SubmitMessageSearch = request.getParameter("SubmitMessageSearch");
			String message_search = request.getParameter("message_search");		
			String Order_By_SenderName = request.getParameter("Order_By_SenderName");
			String Order_By_Topic = request.getParameter("Order_By_Topic");
			String Order_By_Email = request.getParameter("Order_By_Email");
					
			if (SubmitMessageSearch != null && SubmitMessageSearch.length() > 0) {
		%>
		<%=Message.DisplayMessage(message_search, Order_By_SenderName, Order_By_Topic, Order_By_Email) %>
		<% 		
			//con.close(); 
			} 
		} catch(Exception e) 
		{out.println(e);} 
		%> 
		</table> </td></tr>
		</table>			
<%
	//Delete a selected message
	String SubmitMessageDelete = request.getParameter("SubmitDeleteMessage");
	if (SubmitMessageDelete != null && SubmitMessageDelete.length() > 0)
	{
		String DeleteMessageID = request.getParameter("DeleteMessage");
%>
<%=Message.DeleteMessage(DeleteMessageID) %>
		
<%}%>

	</TABLE>
</BODY>
